package com.tjn.exercise;

import com.sun.jmx.snmp.SnmpPduTrap;

public class Exercise02 {
    public static void main(String[] args) {
        Car car = new Car(50);
        car.getAir().flow();
        System.out.println("--------------------------------");
        Car car2 = new Car(-10);
        car2.getAir().flow();
        System.out.println("--------------------------------");
        Car car3 = new Car(30);
        car3.getAir().flow();
    }
}

class Car{
    private double temperature;

    public Car(double temperature) {
        this.temperature = temperature;
    }

    class Air{
        public void flow(){
            if(temperature > 40){
                System.out.println("空调吹冷风");
            }else if(temperature < 0){
                System.out.println("空调吹暖风");
            }else{
                System.out.println("温度适宜，关闭空调");
            }
        }
    }
    public Air getAir(){
        return new Air();
    }
}